package com.heima.day531_字符串;

import java.util.Scanner;

public class login {
    public static void main(String[] args) {
        String uername = "admin";
        String password = "123456";

        Scanner sc = new Scanner(System.in);

        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名：");
            String scUsername = sc.nextLine();
            System.out.println("请输入密码：");
            String scPassword = sc.nextLine();

            if (uername.equals(scUsername) && password.equals(scPassword)) {
                System.out.println("登录成功");
                break;
            } else {
                if (i == 3) {
                    System.out.println("您今日输入次数已用完，请明日再试");
                } else {
                    System.out.println("登录失败,您还剩余" + (3 - i) + "次机会");
                }
            }
        }

    }
}
